import { SwiperBox } from '@/design';
import React from 'react';
import GoodCard from '../GoodCard/GoodCard';
import styles from './Items.less';

interface ICouponSwiper {
  ikey: string
  dataSource: Array<any> | undefined
  // recive: boolean
  options?: {
    slidesPerView: 'auto' | number
    spaceBetween: number
  }
  // onRecive?: () => void
}

export default function (props: ICouponSwiper) {
  return <SwiperBox
    ikey={props.ikey}
    data={props.dataSource || []}
    options={{
      autoplay: true,
      slidesPerView: 'auto',
      centeredSlides: true,
      pagination: false,
      initialSlide: 1,
    }}
    wrapClass={styles.swiper_wrap}
    itemClass={styles.swiper_slide}
    renderRow={(item:any, index:any) => (
      <GoodCard ikey={`${item.productId}_${index}`} goodDetail={item}/>
    )}
  />
}